<template>
  <div>
    <van-sticky :offset-top="1">
      <header id="header" class="aui-bar aui-bar-nav">
          <a class="aui-pull-left" @click="back">
              <span class="iconfont icon-fanhui"></span>
          </a>
          <div class="aui-title">操作记录</div>
      </header>
    </van-sticky>
    <div v-if="record.items.length > 0" v-cloak>
      <div class="list aui-bg-f aui-padded-l-10 aui-padded-r-10 aui-padded-t-15 aui-padded-b-15 aui-ftn14 aui-text-7 van-hairline--bottom" v-for="(item, index) in record.items" :key="index">
          <div v-text="item.craetetime">
          </div>
          <div class="aui-margin-t-10" v-text="item.text">
          </div>
      </div>
  </div>
  <div v-if="record.isTotal && record.items.length == 0" v-cloak>
      <div class="no-data aui-text-center aui-text-9">
          <i class="iconfont icon-lujing1161"></i>
          <div class="aui-ftn16">
              空空如也~
          </div>
      </div>
  </div>
  </div>
</template>

<script>
  import Record from '../../service/record.js'
  export default {
    data () {
      return {
        record: {
            isLoading: false,
            isTotal: false,
            items: []
        }
      }
    },
    mounted() {
      this.fnGetRecordData()
    },
    methods: {
      fnGetRecordData: function() {
          if (!this.record.isLoading && !this.record.isTotal) {
              this.record.isLoading = true;
              Record.fnGetCzRecord({order_id: this.$route.params.order_id, isToken: true}).then(data => {
                this.record.isLoading = false;
                if (data && data.status) {
                    this.record.items = data.data;
                } else {
                    this.record.isTotal = true;
                }
              })
          }
      }
    }
  }
</script>

<style>
</style>
